package collection;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
public class GenericDemo {
    public static void main(String[] args) {
        Collection<String> c = new ArrayList();
        c.add("abc");
        c.add("bcd");
        c.add("ccc");
        c.add("ddd");

        Iterator<String> it = c.iterator();
        while(it.hasNext()) {
            String str = it.next();
            System.out.println(str);
        }

        Collection<Point> c1 = new ArrayList();
        c1.add(new Point(5,3));
        c1.add(new Point(5,4));
        c1.add(new Point(5,5));
        c1.add(new Point(5,6));
        c1.add(new Point(5,7));

        Iterator<Point> it1 = c1.iterator();
        while(it1.hasNext()) {
            Point p1 = it1.next();
            System.out.println(p1);
        }

        for(Point p2 : c1) {
            System.out.println(p2);
        }

    }
}
